import { ProTable } from '@ant-design/pro-components';
import styles from './index.less';

interface Props {
  title: string;
  columns: any[];
  labelWidth: any;
  reset: any;
  submit: any;
  formRef: any;
  [key: string]: any;
}
const BaseSearchTable = ({
  title,
  columns,
  labelWidth,
  reset = () => {},
  submit = () => {},
  formRef = {},
  ...rest
}: Props) => {
  return (
    <div className={styles.myTable}>
      {/* <QueryFilter defaultCollapsed split form={form}>
        <Form.Item label="名称" name="name">
          <Input placeholder="请输入" />
        </Form.Item>
      </QueryFilter> */}
      <ProTable
        headerTitle={title}
        // actionRef={actionRef}
        formRef={formRef}
        search={{
          labelWidth: labelWidth ?? 120,
          defaultCollapsed: false,
        }}
        onSubmit={submit}
        onReset={reset}
        rowKey={'id'}
        columns={columns}
        scroll={{ x: 1000 }}
        pagination={{
          showQuickJumper: true,
          showSizeChanger: true,
          // showTotal: (total) =>
          //   `共${total}条记录 第${pageNum}/${Math.ceil(total / pageSize)}页`,
        }}
        {...rest}
      />
    </div>
  );
};

export default BaseSearchTable;
